//
//  MSettingViewController.m
//  Mask
//
//  Created by 郭子一 on 2020/10/2.
//  Copyright © 2020 郭子一. All rights reserved.
//

#import "MSettingViewController.h"
#import "MSettingCell.h"
@interface MSettingViewController ()<UITableViewDelegate,UITableViewDataSource>

@property (nonatomic, strong) UITableView *tableView;

@end

@implementation MSettingViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.showNavView = YES;
    self.navTitleLab.text = @"设置";
    [self makeUI];
}

- (void)makeUI
{
    UIView *view = [[UIView alloc] init];
    [self.view addSubview:view];
    view.layer.backgroundColor = [UIColor colorWithRed:255/255.0 green:255/255.0 blue:255/255.0 alpha:1.0].CGColor;
    view.layer.cornerRadius = 10;
    view.layer.shadowColor = [UIColor colorWithRed:93/255.0 green:102/255.0 blue:147/255.0 alpha:0.15].CGColor;
    view.layer.shadowOffset = CGSizeMake(0,2);
    view.layer.shadowOpacity = 1;
    view.layer.shadowRadius = 8;
    [view mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.offset(15);
        make.right.offset(-15);
        make.top.equalTo(self.navTitleLab.mas_bottom).offset(53);
        make.height.mas_equalTo(174);
    }];
    
    _tableView = [[UITableView alloc] initWithFrame:CGRectMake(0, 0, kGScreenWidth, kGScreenHeight) style:UITableViewStylePlain];
    _tableView.dataSource = self;
    _tableView.delegate = self;
    _tableView.separatorStyle = UITableViewCellSeparatorStyleNone;
    _tableView.backgroundColor = UIColor.clearColor;
    _tableView.layer.masksToBounds = YES;
    _tableView.layer.cornerRadius = 8;
    [_tableView registerClass:[MSettingCell class] forCellReuseIdentifier:@"MSettingCell"];
    [view addSubview:_tableView];
    [_tableView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.edges.offset(0);
    }];
}

- (NSInteger)tableView:(UITableView *)tableView
 numberOfRowsInSection:(NSInteger)section
{
    return 3;
}

- (UITableViewCell *)tableView:(UITableView *)tableView
         cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    MSettingCell *cell = [tableView dequeueReusableCellWithIdentifier:@"MSettingCell"];
    if (indexPath.row == 0) {
        cell.titleLab.text = @"关于我们";
    } else if (indexPath.row == 1) {
        cell.titleLab.text = @"常见问题";
    } else if (indexPath.row == 2) {
        cell.titleLab.text = @"清除缓存";
        cell.rightLab.text = @"45.5M";
        cell.lineView.hidden = YES;
    }
    return cell;
}

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{

    return 58;
}

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    
}

@end
